package libnetdb.dm.assoc.dhp.demo;

import libnetdb.dm.assoc.base.*;
import libnetdb.dm.assoc.dhp.*;
import libnetdb.dm.assoc.util.*;

/**
 * This class implements the AROutput interface so that it can be
 * treated as an output of <code>DHPMiner</code>. It read the
 * large itemset from the miner and directly add it to the rule
 * set builder. So, after the mining process finishing, we can
 * obtain the rule set immediately.
 *
 * @author Cheng-Ru Lin
 * @version 1.0
 */
public class DirectBuilder implements AROutput{
    private RuleSetBuilder builder = new RuleSetBuilder();
    private double support = 0;

    public DirectBuilder() {
    }

    public void setSupport(double support){
        this.support = support;
    }

    public void setTransactionNumber(int tranx_numb){
        builder.reset(tranx_numb, support);
    }

    public void writeLitemset(Litemset litemset){
        builder.addLitemset(litemset);
    }

    public RuleSet getRuleSet(){
        return builder.getRuleSet();
    }
    
    public void open(){        
    }
    
    public void close(){        
    }

}